package com.sm.healthy.data.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sm.healthy.data.bean.UserEntity

/**
 * @description
 * @author csw
 * @date 2021-05-05
 */
@Dao
interface UserDao {
    @Insert
    suspend fun insert(user: UserEntity)

    @Update
    suspend fun update(user: UserEntity)

    @Delete
    suspend fun delete(user: UserEntity)

    @Query("Delete FROM users")
    suspend fun deleteAll()

    @Query("SELECT * FROM users")
    fun getCustomers(): LiveData<List<UserEntity>>

    @Query("SELECT * FROM users WHERE uid = :userId")
    fun getCustomer(userId: Long): LiveData<UserEntity>
}